﻿using Inovout.People.Models;
using Inovout.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Inovout.People.Services
{
    public class PhoneService : RepositoryService<Phone>, IPhoneService
    {
        public Phone GetPhone(string value)
        {
            IRepositoryService<Phone> phoneService = ComponentRegistry.Resolve<IRepositoryService<Phone>>();
            IQueryable<Phone> phones = phoneService.Query().Where(mode => mode.Value.Equals(value));
            if (phones != null && phones.Count() > 0)
            {
                return phones.First();
            }
            else {
                return null;
            }
            
        }
    }
}
